<?php
   $csv_output = "badgename"; 
   $csv_output .= "\n"; 
//outputs everything separated by commas
   foreach($confregs as $reg) { 
		$person = $reg->getRegistrantId();
        $person2 = RegistrantPeer::retrieveByPK($person);
		$n = $person2->getName();

       $csv_output .= "$n\n";
       } 
//this is where you set file specific settings
   header("Content-type: application/vnd.ms-excel");
   header("Content-disposition:  attachment; filename=confbadges_".date("Y-m-d").".csv");
   print $csv_output;
   exit;  
?>